package com.slz3.business.module.afterSaleManagement.aftApplyOrderLine.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.afterSaleManagement.aftApplyOrderLine.domain.AftApplyOrderLine;
import com.slz3.business.module.afterSaleManagement.aftApplyOrderLine.domain.AftApplyOrderLineFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class AftApplyOrderLineTransactionalServiceImpl implements AftApplyOrderLineTransactionalService {

    @Override
    public AftApplyOrderLine modify(AftApplyOrderLine aftApplyOrderLineNew) {
        Repositorys.aftApplyOrderLine.test();
        Repositorys.aftApplyOrderLine.save(AftApplyOrderLineFactory.initBaseFields());
        System.err.println(1/0);
        aftApplyOrderLineNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.aftApplyOrderLine.saveAndFlush(aftApplyOrderLineNew);
    }

    @Override
    public List<AftApplyOrderLine> batchModify(List<AftApplyOrderLine> aftApplyOrderLineList) {
        return Repositorys.aftApplyOrderLine.saveAll(aftApplyOrderLineList);
    }
}
